/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package utilidades;

import io.Operador;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author NiCo
 */
public class DatosDePrueba {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Operador op = new Operador();
        op.setNombre("Nicolás");
        op.setApellido("Mannise");
        op.setDni(Long.MIN_VALUE);
        op.setTelefono("099659972");
        persist(op);
    }

    public static void persist(Object object) {
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("102-LineaDeLosDerechosPU");
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        try {
            em.persist(object);
            em.getTransaction().commit();
        } catch (Exception e) {
            e.printStackTrace();
            em.getTransaction().rollback();
        } finally {
            em.close();
        }
    }
    
}
